package com.log4jviewer.ui.preferences.additional;

/**
 * Table, where every log is appeared, called Log Table, has columns. Every column represents one of the log field. This
 * class defines constants and default display values for table columns' settings in additional preferences.
 * 
 * @author <a href="mailto:rd.ryly@gmail.com">Ruslan Diachenko</a>
 */
public enum LogFieldColumn {

    LEVEL_COLUMN("level_column", 0, 100, true),
    CATEGORY_COLUMN("category_column", 1, 100, true),
    MESSAGE_COLUMN("message_column", 2, 100, true),
    LINE_COLUMN("line_column", 3, 100, true),
    DATE_COLUMN("date_column", 4, 100, true),
    NDC_COLUMN("ndc_column", 5, 100, true),
    THROWABLE_COLUMN("throwable_column", 6, 100, true);

    public static final String SEPARATOR = ":";

    private String id;

    private String defaultPrefs;

    private LogFieldColumn(final String id, final int defaultIndex, final int defaultWidth, final boolean defaultDisplay) {
        this.id = id;
        StringBuilder prefsBuilder = new StringBuilder();
        prefsBuilder.append(defaultIndex).append(SEPARATOR).append(defaultWidth).append(SEPARATOR)
                .append(defaultDisplay);
        defaultPrefs = prefsBuilder.toString();
    }

    public String getId() {
        return id;
    }

    public String getDefaultPrefs() {
        return defaultPrefs;
    }
}
